feat(refund-vault): add oracle aggregator + median-based dynamic refund policy engine - #262
Conversation
…nd policy engine 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@adelekevictor12 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
MergeKeeper review Scope: in scope for linked issue The PR successfully implements the oracle aggregator, standard oracle interface, and median-based dynamic refund policy engine with thorough test coverage and security considerations. Reviewed commit: |
|
MergeKeeper merge status Status: blocked Reason: One or more required CI checks failed. Failing checks:
Next steps:
|
|
done |
|
Needs changes The refund logic refactor in
Reviewed commit: |
There was a problem hiding this comment.
Needs changes
The refund logic refactor in lib.rs introduces syntax errors and disrupted control flow around ceiling checks and event publication.
contracts/refund-vault/src/lib.rs:829: Malformed code block inrefund_internal:.publish(env);is called as a method on a closing brace rather than on an event struct instance, andrelease_reentrancy_lock(env)is called with an argument instead ofrelease_reentrancy_lock(&env).contracts/refund-vault/src/lib.rs:816: The ceiling check and update logic was truncated/displaced during refactoring, leading to potential type errors and incorrect verification order.
Reviewed commit: 8eedcdc1413a406cec2b8bf798fcdc8ac33648d0.
…in roles Adds a new `governance` contract that closes the single-admin-key SPOF on ReceiptAnchor's merchant role: a fixed set of weighted members propose a call, vote on it over a bounded window, and once "yes" weight clears a configured quorum and outweighs "no", anyone can execute it. No change to the governed contract is needed — the host's own self-authorization rule (a contract's require_auth() on its own address auto-succeeds when it is the direct caller) carries the authority through when Governance calls into ReceiptAnchor's existing merchant-gated functions, the same mechanism already used for a MultisigAccount admin. ReceiptAnchor has no upgrade entry point, and docs/ADR-003-upgradeability.md (accepted) forbids adding one without reopening that ADR, so this wrapper gates only the admin surface that actually exists today (set_min_anchor_interval, anchor_batch, prune_batches) rather than introducing upgrade authority. Storage is kept small on purpose: each member's weight is its own persistent entry, per-voter "already voted" markers live in temporary storage so they expire with the voting window on their own, and a resolved proposal's calldata can be reclaimed immediately via prune_proposal instead of waiting on archival. Also fixes two pre-existing, unrelated build breaks discovered while wiring up governance's own tests, both required just to get `cargo build` / `cargo test` working across the workspace again: - receipt-anchor and refund-vault Cargo.toml declared their optional `budget_macros` dependency under [dev-dependencies], which Cargo disallows (optional dev-dependencies are not permitted); moved it to [dependencies], still gated by the `budget-assert` feature and only referenced from a #[cfg(test)] module, so it never links into a real build. - receipt-anchor's test_shared_vectors_cover_required_edge_cases used the bare `Vec` identifier, which resolves to soroban_sdk::Vec (imported at the top of the file) instead of std's Vec, and doesn't implement FromIterator<&str>; qualified it as std::vec::Vec explicitly. Note: contracts/refund-vault/src/lib.rs has a separate, still-unfixed issue — add_oracle (added in #262) is missing its body/closing brace and currently fails to compile at all. Left alone here since it's unrelated to this change and its intended whitelist-insertion logic isn't specified anywhere I could find.
Closes #133